Direct memory access (DMA) allows hardware devices in a computer to access system memory for reading and/or writing independently of the central processing unit (CPU). Hardware devices that are capable of performing DMA include disk drive controllers, graphics cards, network cards and sound cards. While a hardware device is performing the DMA, the CPU can engage in other operations. DMA is especially useful in real-time computing applications where it is critical to avoid the stalling of concurrent operations.
A computer having DMA-capable devices often uses an input/output memory management unit (IOMMU) to manage address translations. In a virtual machine system, the guest operating system of a virtual machine usually does not know the host physical address that it accesses. Instead, the virtual machine system operates using virtualized guest physical addresses. Typically, multiple virtual machines share the same memory for reading the same data. The memory can be write protected to prevent the virtual machines from writing to the shared memory. When a virtual machine attempts to modify the shared memory, a page fault is typically triggered to cause a copy of the memory to be created, which the virtual machine can use to make a modification. With conventional DMA systems, if a device is assigned to a guest operating system of a virtual machine and attempts to modify shared memory, a page fault is typically not triggered and an error can occur. Most devices in traditional DMA system cannot recover from such errors and handling the error recovery in real time incurs significant overhead that degrades the performance of the system.